package cn.thoughtworks.school.response;

import lombok.*;

import java.util.Map;

@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SimplePublisherResponse {
  private Long id;
  private String username;
  private String email;
  private Boolean isPublisher;

  public static SimplePublisherResponse build(Map user,Boolean isPublisher) {
    return SimplePublisherResponse.builder()
        .id(Long.valueOf(user.get("id").toString()))
        .username(user.get("username").toString())
        .email(user.get("email").toString())
        .isPublisher(isPublisher).build();
  }
}
